#ifndef function_H
#define function_H
#include <QSqlDatabase>
#include <QDebug>
#include<QSqlQuery>
#include <QMessageBox>
#include <QSqlError>
#include <regex>
#include <QFile>
#include "routeplanning.h"
#include <QMainWindow>
#include <QDebug>
#include <QThread>
#include <QObject>
#include <QList>

#pragma execution_character_set("utf-8")

struct wayInfo
{
    QList<double> point1;
    QList<double> point2;
    QList<QString> name;
    QList<double> weight;
};

class function : public QObject
{
    Q_OBJECT

public:
    explicit function(QObject *parent = nullptr);
    int userID;

signals:
    void resultReady(const QString &str);

public slots:
    const QString login(QString userID,QString pw);
    const QString registering(QString userID,QString pw,QString name,
                              int permission,QString siteResponse, QString RecommendationCode);
    const int getResponse(int userID);
    const QString getPersonalInfo(int userID);
    const QString setNewPW(int userID,QString oldPW,QString newPW);
    const QString setNewName(int userID,QString newName);
    const QString newSite(QString siteName,QString x,QString y,int type);
    static const QStringList getTerminalList();
    static const QStringList getSitesList();
    const QString delSite(QString siteName);
    const QString newWay(QString from,QString to,QString time,QString fee);
    const QString delWay(QString from,QString to);
    const QVector<QStringList> getAllGoodInfo();
    const QVector<QStringList> getAccurateGoodInfo(int type,QString keyWords);
    const QVector<QStringList> getSiteGoodInfo(QString site,int ststus,QString keyWords);
    const QString addGoodInfo(QString goodsId,QString userId,QString dispatchPlace,
                              QString receivePlace,QString consignerName,
                              QString consigneeName,QString consignerTele,
                              QString consigneeTele,QString trackingNum,
                              QString currentPlace,QString dispatchTime,QString note);
    const QString editGoodInfo(QString goodsId,QString userId,QString dispatchPlace,
                              QString receivePlace,QString consignerName,
                              QString consigneeName,QString consignerTele,
                              QString consigneeTele,QString trackingNum,
                              QString currentPlace,QString dispatchTime,QString note);
    const QString delGoodInfo(QString goodsId);
    const QVector<QStringList> mailPushing(QString from,QString to);
    const QString pay(QString dispatchPlace,QString receivePlace,QString userId,
                      QString consignerName,QString consignerTele,
                      QString consigneeName,QString consigneeTele,
                      int pushChoosing,double cost);
    const wayInfo getWay();


};

#endif // function_H


